namespace SinaFinanceBaseClassLibrary
{
    using System;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Media;
    using System.Windows.Shapes;

    public class AxisSysFramework : UserControl
    {
        private int controlZindex = 10;
        private Color frameworkColor = Colors.White;
        private double frameworkLineTickness = 0.7;
        private Canvas parentCanvas;
        private Point pointLeftBottom = new Point();
        private Point pointLeftTop = new Point();
        private Point pointRightBottom = new Point();
        private Point pointRightTop = new Point();
        private int xAxisMarkCount = 0;
        private double xAxisUnitLen = 0.0;
        private int yAxisMarkCount = 0;
        private double yAxisUnitLen = 0.0;

        public void RenderAxisSysFramework()
        {
            int num;
            Line line = new Line();
            Line line2 = new Line();
            Line line3 = new Line();
            Line line4 = new Line();
            line.X1 = this.pointLeftTop.X;
            line.Y1 = this.pointLeftTop.Y;
            line.X2 = this.pointLeftBottom.X;
            line.Y2 = this.pointLeftBottom.Y;
            line2.X1 = this.pointRightTop.X;
            line2.Y1 = this.pointRightTop.Y;
            line2.X2 = this.pointRightBottom.X;
            line2.Y2 = this.pointRightBottom.Y;
            line3.X1 = this.pointLeftBottom.X;
            line3.Y1 = this.pointLeftBottom.Y;
            line3.X2 = this.pointRightBottom.X;
            line3.Y2 = this.pointRightBottom.Y;
            line4.X1 = this.pointLeftTop.X;
            line4.Y1 = this.pointLeftTop.Y;
            line4.X2 = this.pointRightTop.X;
            line4.Y2 = this.pointRightTop.Y;
            line.Stroke = new SolidColorBrush(this.FrameworkColor);
            line2.Stroke = new SolidColorBrush(this.FrameworkColor);
            line3.Stroke = new SolidColorBrush(this.FrameworkColor);
            line4.Stroke = new SolidColorBrush(this.FrameworkColor);
            line.StrokeThickness = this.frameworkLineTickness;
            line2.StrokeThickness = this.frameworkLineTickness;
            line3.StrokeThickness = this.frameworkLineTickness;
            line4.StrokeThickness = this.frameworkLineTickness;
            line4.StrokeDashArray.Add(2.0);
            line.SetValue(Canvas.ZIndexProperty, this.controlZindex);
            line2.SetValue(Canvas.ZIndexProperty, this.controlZindex);
            line3.SetValue(Canvas.ZIndexProperty, this.controlZindex);
            line4.SetValue(Canvas.ZIndexProperty, this.controlZindex);
            this.parentCanvas.Children.Add(line);
            this.parentCanvas.Children.Add(line2);
            this.parentCanvas.Children.Add(line3);
            this.parentCanvas.Children.Add(line4);
            for (num = 1; num < (this.xAxisMarkCount - 1); num++)
            {
                Line line5 = new Line {
                    X1 = this.pointLeftTop.X + (this.XAxisUnitLen * num),
                    Y1 = this.pointLeftTop.Y,
                    X2 = this.pointLeftBottom.X + (this.xAxisUnitLen * num),
                    Y2 = this.pointLeftBottom.Y,
                    Stroke = new SolidColorBrush(this.FrameworkColor),
                    StrokeThickness = this.frameworkLineTickness
                };
                line5.StrokeDashArray.Add(2.0);
                line5.SetValue(Canvas.ZIndexProperty, this.controlZindex);
                this.parentCanvas.Children.Add(line5);
            }
            for (num = 1; num < this.YAxisMarkCount; num++)
            {
                Line line6 = new Line {
                    X1 = this.pointLeftTop.X,
                    Y1 = this.pointLeftTop.Y + (this.yAxisUnitLen * num),
                    X2 = this.pointRightTop.X,
                    Y2 = this.pointRightTop.Y + (this.yAxisUnitLen * num),
                    Stroke = new SolidColorBrush(this.FrameworkColor),
                    StrokeThickness = this.frameworkLineTickness
                };
                line6.StrokeDashArray.Add(2.0);
                line6.SetValue(Canvas.ZIndexProperty, this.controlZindex);
                this.parentCanvas.Children.Add(line6);
            }
        }

        public int ControlZindex
        {
            get
            {
                return this.controlZindex;
            }
            set
            {
                this.controlZindex = value;
            }
        }

        public Color FrameworkColor
        {
            get
            {
                return this.frameworkColor;
            }
            set
            {
                this.frameworkColor = value;
            }
        }

        public double FrameworkLineTickness
        {
            get
            {
                return this.frameworkLineTickness;
            }
            set
            {
                this.frameworkLineTickness = value;
            }
        }

        public Canvas ParentCanvas
        {
            get
            {
                return this.parentCanvas;
            }
            set
            {
                this.parentCanvas = value;
            }
        }

        public Point PointLeftBottom
        {
            get
            {
                return this.pointLeftBottom;
            }
            set
            {
                this.pointLeftBottom = value;
            }
        }

        public Point PointLeftTop
        {
            get
            {
                return this.pointLeftTop;
            }
            set
            {
                this.pointLeftTop = value;
            }
        }

        public Point PointRightBottom
        {
            get
            {
                return this.pointRightBottom;
            }
            set
            {
                this.pointRightBottom = value;
            }
        }

        public Point PointRightTop
        {
            get
            {
                return this.pointRightTop;
            }
            set
            {
                this.pointRightTop = value;
            }
        }

        public int XAxisMarkCount
        {
            get
            {
                return this.xAxisMarkCount;
            }
            set
            {
                this.xAxisMarkCount = value;
            }
        }

        public double XAxisUnitLen
        {
            get
            {
                return this.xAxisUnitLen;
            }
            set
            {
                this.xAxisUnitLen = value;
            }
        }

        public int YAxisMarkCount
        {
            get
            {
                return this.yAxisMarkCount;
            }
            set
            {
                this.yAxisMarkCount = value;
            }
        }

        public double YAxisUnitLen
        {
            get
            {
                return this.yAxisUnitLen;
            }
            set
            {
                this.yAxisUnitLen = value;
            }
        }
    }
}
